"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from . import views
urlpatterns = [
    url(r"^register/$",views.RegisterView.as_view(),name="register"),
    url(r"^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$", views.UsernameCountView.as_view(), name="usernamecount"),
    #3.判断手机号是否重复mobiles/(?P<mobile>1[3-9]\d{9}/count/)
    url(r"^mobiles/(?P<mobile>1[3-9]\d{9})/count/$", views.MobileCountView.as_view(),name="mobile"),
    # 登陆功能
    url(r"^login/$",views.LoginView.as_view(),name="login"),
    #退出功能
    url(r"^logout/$",views.LogoutView.as_view(),name="logout"),

#6. 个人中心 info/
    url(r'^info/$', views.UserInfoView.as_view(), name="info"),
    # 7.修改邮箱的值
    url(r"^emails/$",views.EmailView.as_view(),name="email"),
    #8.激活邮箱emails/verification
    url(r"^emails/verification/$",views.VerifyEmailView.as_view(),name="verifyemail"),
    #9.显示收货地址address/
    url(r"^address/$",views.AddressView.as_view(),name="address"),
# 新增地址addresses/create
    url(r"^addresses/create/$",views.CreateAddressView.as_view(),name="create_address"),
    #修改和删除
    url(r"^addresses/(?P<address_id>\d+)/$",views.UpdateDestroyAddressView.as_view(),name="update_address"),
    # 设置默认地址
    url(r"^addresses/(?P<address_id>\d+)/default/$", views.DefaultAddressView.as_view(), name="default_address"),
# 修改标题
    url(r"^addresses/(?P<address_id>\d+)/title/$", views.TitleAddressView.as_view(), name="title_address"),
    #显示修改密码页面
    url(r"^password/$",views.ChangePwdView.as_view(),name="change_pwd"),
    # 15. 浏览记录 browse_histories/
    url(r'^browse_histories/$', views.HistoryBrowseView.as_view(), name="browse"),
]
#usernames/(?<username>[a-zA-Z0-9_-]{5,20})/count/